package com.zhike.common.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
@ApiModel("群组基本信息实体")
@TableName("zhike_group_base")
public class GroupBase implements Serializable {
    /**
     * BBS聊天（即世界频道）所对应的群组聊天id（因为世界频道是个特殊
     * 的群聊，属系统默认无需创建，所以给它一个默认的固定id，以便跟普
     * 通群聊区分开来）.
     */
    public final static String DEFAULT_GROUP_ID_FOR_BBS = "-1";

    private static final long serialVersionUID = 1L;

    @TableId(value = "g_id", type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "群ID")
    private String groupId;

    @ApiModelProperty(value = "群号码")
    private String groupNumber;

    @ApiModelProperty(value = "状态")
    @TableField(value = "g_status")
    private Integer status;

    @ApiModelProperty(value = "群名")
    private String name;

    @ApiModelProperty(value = "群主")
    private String ownerUserUid;

    @ApiModelProperty(value = "群公告")
    private String notice;

    @ApiModelProperty(value = "群人数上限")
    private Integer maxMemberCount;

    @ApiModelProperty(value = "")
    private Integer memberCount;

    @ApiModelProperty(value = "群首次建立者id。")
    private String createUserUid;

    @ApiModelProperty(value = "")
    private Date createTime;

    @ApiModelProperty(value = "用于记录封禁群的后台人员id。")
    private String forbidUserUid;

    @ApiModelProperty(value = "用于记录封禁群的时间。")
    private Date forbidTime;

    @ApiModelProperty(value = "用于记录封禁群的理由。")
    private String firbidCause;

    @ApiModelProperty(value = "")
    private Long noticeUpdatetime;

    @ApiModelProperty(value = "")
    private String noticeUpdateuid;

    private String noticeUpdateNickname;

    @ApiModelProperty(value = "")
    private String delUserUid;

    @ApiModelProperty(value = "")
    private Date delTime;

    @ApiModelProperty(value = "")
    private Long avatarIncludeCnt;

    @ApiModelProperty(value = "全员禁言（1丶是 0丶否）")
    private Integer allPersonProhibitMsg;

    @ApiModelProperty(value = "隐私群组（1丶是 0丶否）")
    private Integer privacyGroups;

    @ApiModelProperty(value = "入群验证（1丶是 0丶否）")
    private Integer groupingVerification;

    @ApiModelProperty(value = "是否允许群内成员私聊  0：允许  0：不允许")
    private Integer allowPrivateChat;

    @ApiModelProperty(value = "语音模式（1丶是 0丶否）")
    private Integer voiceMode;

    @ApiModelProperty(value = "设置发言间隔")
    private String speechInterval;

    @ApiModelProperty(value = "群自定义昵称")
    private String nicknameInGroup;

    @ApiModelProperty(value = "是否管理员 1是0否")
    private String isAdmin;

    @ApiModelProperty(value = "群简介")
    private String groupDesc;

    @ApiModelProperty(value = "群头像更新时间")
    private Long avatarUpdatetime;

    @ApiModelProperty(value = "会话置顶")
    private Integer isTop;

    @ApiModelProperty(value = "免打扰")
    private Integer nodisturb;

    /**
     * 指定id是否是“世界频道”（或者说是bbs聊天）。
     * 
     * @param gid 群id
     * @return true表示是世界频道，否则不是
     */
    public static boolean isWorldChat(String gid) {
        return GroupBase.DEFAULT_GROUP_ID_FOR_BBS.equals(gid);
    }
}
